package comm

import (
	"d-serv-go/server/core/config"

	"math/rand"
	"strconv"
)

// 是否是正式环境
func IsProd() bool {
	return config.Instance.Env == "prod"
}

// 生成随机验证码
func RandomCode(len int) string {
	if len <= 0 {
		len = 4
	}
	var code string
	for i := 0; i < len; i++ {
		code += strconv.Itoa(rand.Intn(10))
	}
	return code
}
